package com.day9_Map_test;

import java.util.ArrayList;
import java.util.Collections;

/**
 * @ClassName: Poker_demo
 * @Author: zw
 * @Description: 出百万拳，行万里路；
 * @Create 2024/3/10-17:42
 * @Version 1.0
 */
public class Poker_demo {
    public static void main(String[] args) {
        // 创建牌盒
        // 创建 牌， 花色和数字，大小王；
        // 创建三个人
        // 创建底牌
        ArrayList<String> pokerArr = new ArrayList<String>();
        // 花色

        String[] pokerNumber = {"2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"};
        String[] colors = {"♣️", "♠️", "♥️", "♦️"};
        for (String color: colors) {
            for (String pokernumber: pokerNumber) {
                pokerArr.add(color+pokernumber);
            }
        }
        pokerArr.add("大王");
        Collections.shuffle(pokerArr); // 随机
        ArrayList<String> zw1 = new ArrayList<String>();
        ArrayList<String> zw2 = new ArrayList<String>();
        ArrayList<String> zw3 = new ArrayList<String>();

        ArrayList<String> diArr = new ArrayList<String>();

        for (int i = 0; i < pokerArr.size(); i++) {
            if(i >= pokerArr.size() - 3) {
                diArr.add(pokerArr.get(i));
            } else if (i % 3 ==0) {
                zw1.add(pokerArr.get(i));

            } else if (i % 3 == 1) {
                zw2.add(pokerArr.get(i));
            } else {
                zw3.add(pokerArr.get(i));
            }
        }
        getPokerByName("zw1", zw1);
        getPokerByName("zw2", zw2);
        getPokerByName("zw3", zw3);
        getPokerByName("底牌", diArr);
    }
    public  static void getPokerByName(String name, ArrayList<String> arrayList) {
        Collections.sort(arrayList);
        System.out.print(name+"的底牌是:");
        for (String s: arrayList) {
            System.out.print(s + " ");
        }
        System.out.println();
    }
}
